@toolbar-btn-size: 24px;

.headerbar {
    user-select: none;
    position: relative;

    > .header-menu {
        position: absolute;
        top: 0;
        right: 0;

        display: flex;

        box-sizing: border-box;
        height: 100%;

        > div {
            user-select: none;

            display: inline-flex;
            align-items: center;

            height: 28px;
            margin-left: 4px;
            padding: 2px 4px;

            text-align: center;

            border-radius: 4px;

            &:hover {
                background-color: rgb(var(--grey-300));
            }
        }
    }
}

.menubar {
    display: flex;
    gap: var(--margin-xs);
    align-items: center;
    justify-content: center;

    height: 32px;

    &-item {
        cursor: pointer;

        display: block;

        padding: var(--padding-xs) var(--padding-sm);

        font-size: var(--font-size-xs);
        font-weight: 400;

        border-radius: var(--border-radius-base);

        transition: all 0.1s ease-in-out;

        &:hover:not(&-active) {
            background: rgb(var(--grey-300));
        }

        &-active {
            color: rgb(var(--color-white));
            background: rgb(var(--primary-color));
        }
    }
}

.toolbar {
    user-select: none;

    position: relative;

    display: flex;
    align-items: center;

    box-sizing: border-box;
    height: 32px;

    font-size: var(--font-size-base);
    color: rgb(var(--text-color));

    background-color: rgb(var(--bg-color-secondary));
    border-bottom: 1px solid rgb(var(--border-color));

    &-container {
        padding: 0 var(--padding-lg);
        display: flex;
        gap: var(--margin-xs);
        align-items: center;
        justify-content: center;

        box-sizing: border-box;
        height: 100%;
        margin: 0 auto;
        max-width: 100%;
        overflow: hidden;
    }

    &-more {
        max-width: 80%;

        &-container {
            display: grid;

            box-sizing: border-box;
            padding: var(--padding-sm);

            background-color: rgb(var(--bg-color-secondary));
            border-radius: var(--border-radius-base);
            box-shadow: var(--box-shadow-base);

            .toolbar-group {
                flex-wrap: wrap;

                &:not(:last-child) {
                    &::after {
                        content: initial;
                    }

                    > * {
                        margin-bottom: var(--margin-xs);
                    }
                }
            }
        }
    }

    &-group {
        display: flex;
        gap: var(--margin-xs);
        align-items: center;
        flex-shrink: 0;

        > * {
            flex-shrink: 0;
        }

        &:not(:last-child, :empty) {
            &::after {
                content: '';

                display: block;

                width: 1px;
                height: 20px;

                background-color: rgb(var(--border-color));
                flex-shrink: 0;
            }
        }
    }

    &-item {
        &-select-button {
            cursor: pointer;

            position: relative;

            overflow: hidden;
            display: flex;
            gap: var(--margin-xs);
            align-items: center;

            height: @toolbar-btn-size;
            padding-right: 18px;

            font-size: var(--font-size-lg);

            border-radius: var(--border-radius-base);

            &-disabled {
                cursor: not-allowed;
                color: rgb(var(--grey-200));
                &.toolbar-item-select-button-activated {
                    color: rgba(var(--text-color), 0.25);
                    .toolbar-item-select-button {
                        &-label,
                        &-arrow {
                            &:hover {
                                background-color: rgb(var(--grey-100)) !important;
                            }
                        }
                    }
                }
            }

            &-activated {
                background-color: rgb(var(--grey-100));
            }

            &:hover {
                background-color: rgb(var(--grey-100));

                .toolbar {
                    &-item {
                        &-select-button {
                            &-label {
                                background-color: rgb(var(--grey-100));
                            }
                        }
                    }
                }
            }

            &-label {
                position: relative;
                z-index: 1;

                display: flex;
                align-items: center;

                height: 100%;
                padding: 0 var(--padding-xs);

                &:hover {
                    background-color: rgb(var(--grey-300)) !important;
                }
            }

            &-arrow {
                position: absolute;
                top: 0;
                left: 0;

                display: flex;
                align-items: center;
                justify-content: flex-end;

                box-sizing: border-box;
                width: 100%;
                height: 100%;
                padding-right: var(--padding-xs);

                color: rgb(var(--grey-400));

                &:hover {
                    background-color: rgb(var(--grey-300));
                }
            }
        }

        &-select {
            cursor: pointer;

            position: relative;

            display: flex;
            gap: var(--margin-xs);
            align-items: center;

            height: @toolbar-btn-size;
            padding: 0 var(--padding-xs);

            font-size: var(--font-size-lg);

            border-radius: var(--border-radius-base);

            &-disabled {
                cursor: not-allowed;
                color: rgb(var(--grey-200));
                &.toolbar-item-select-activated {
                    color: rgba(var(--text-color), 0.25);
                    &:hover {
                        background-color: rgb(var(--grey-100));
                    }
                }
            }

            &-activated {
                background-color: rgb(var(--grey-100));
            }

            &:hover {
                background-color: rgb(var(--grey-100));
                border-radius: var(--border-radius-base);
            }

            &-arrow {
                display: flex;
                align-items: center;

                height: 100%;

                color: rgb(var(--grey-400));

                &-disabled {
                    cursor: not-allowed;
                    color: rgb(var(--grey-200));
                    &.toolbar-item-select-arrow-activated {
                        color: rgba(var(--text-color), 0.25);
                        &:hover {
                            background-color: rgb(var(--grey-100));
                        }
                    }
                }

                &-activated {
                    background-color: rgb(var(--grey-100));
                }
            }
        }
    }
}
